cmake_minimum_required(VERSION 3.30)
project(demo1)
#set(CMAKE_TOOLCHAIN_FILE "D:/Users/Administrator/.vcpkg-clion/vcpkg/scripts/buildsystems/vcpkg.cmake")
find_package(Boost REQUIRED COMPONENTS json system url property_tree)
find_package(OpenSSL REQUIRED)
#三方库
# 第三方库路径
set(ADD_DLL_DIR ${CMAKE_SOURCE_DIR}/third/add_dll)
# 包含头文件

set(CMAKE_CXX_STANDARD 20)

add_executable(demo1 main.cpp)

target_include_directories(${PROJECT_NAME} PRIVATE ${ADD_DLL_DIR}/include)

# 链接 Boost.JSON
target_link_libraries(demo1 PRIVATE Boost::json Boost::system Boost::url Boost::property_tree OpenSSL::SSL OpenSSL::Crypto ${ADD_DLL_DIR}/lib/add_dll.lib)

if(WIN32)
    add_custom_command(TARGET demo1 POST_BUILD
            COMMAND ${CMAKE_COMMAND} -E copy
            "${ADD_DLL_DIR}/dll/add_dll.dll"
            "$<TARGET_FILE_DIR:demo1>"  # 动态库复制到可执行文件目录
    )
endif()